import request from '@/utils/request'
const debug = process.env.NODE_ENV !== 'production'
const IP = 'http://192.168.107.96:8080'
const testIP = 'http://192.168.0.113:8080'
// const testIP = './ecolLine'
export function login(username, password) {
  const url = debug ? `${testIP}/login` : `${IP}/login`
  return request({
    url: url,
    // method: 'get'
    method: 'post',
    data: {
      username,
      password
    }
  })
}

export function getInfo(token) {
  return request({
    url: './info.json',
    method: 'get'
    // params: { token }
  })
}

export function logout() {
  const url = debug ? `${testIP}/logout` : `${IP}/logout`
  return request({
    url: url,
    method: 'get'
    // url: '/user/logout',
    // method: 'post'
  })
}
